package com.warm.calc.demo.service.parser;


import com.warm.calc.demo.entity.CalcCompleteData;
import com.warm.calc.demo.entity.CalcKeyword;
import com.warm.calc.demo.entity.CalcSourceData;
import com.warm.calc.demo.entity.CalcType;
import org.springframework.stereotype.Component;

import java.util.List;

public abstract class AbstractAttributeParser implements IParser{

    public boolean parserAttribute(CalcSourceData source, CalcCompleteData target, List<CalcKeyword> keywords, List<CalcType> types){
        if(validParameter(source, keywords, types)){
            innerParser(source, target, keywords, types);
        }
        return true;
    }

    protected boolean validParameter(CalcSourceData source, List<CalcKeyword> keywords, List<CalcType> types){
        return true;
    }

    protected abstract void innerParser(CalcSourceData source, CalcCompleteData target, List<CalcKeyword> keywords, List<CalcType> types);
}
